#ifndef PUSHSERVER_LOGGER_H
#define PUSHSERVER_LOGGER_H

#include <string>
#include <spdlog/spdlog.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>

#define console_logger_pattern "[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] [%n] [%s:%#]: %v"
#define file_logger_pattern "[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] [%n] [%g:%#]: %v"

#define Logd(content) SPDLOG_LOGGER_DEBUG(this->logger,content)
#define Loge(content) SPDLOG_LOGGER_ERROR(this->logger,content)
#define Logi(content) SPDLOG_LOGGER_INFO(this->logger,content)
#define Logw(content) SPDLOG_LOGGER_WARN(this->logger,content)

using namespace std;

class Logger : private spdlog::logger {
public:
    enum Sinks {
        Console,
        File,
        Both
    };

    explicit Logger(const string &TAG);

    template<typename... Args>
    void log(spdlog::source_loc loc, spdlog::level::level_enum lvl, Args &&...args) {
        this->logger::log(loc, lvl, "{}", args...);
    }

};

#endif //PUSHSERVER_LOGGER_H
